/**
 * 
 */
package fr.toto.menuitem;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;


import com.kokotchy.betaSeriesAPI.model.Episode;

import fr.toto.constantes.Constantes;
import fr.toto.constantes.Query;
import fr.toto.triseries.EpisodesSet;
import fr.toto.triseries.ExecQuery;

/**
 * @author tshepo
 *
 */
public class SetWatchedMenuItem extends JMenuItem implements Constantes{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1364368653919711530L;
	Episode ep = null;
	/**
	 * 
	 */
	public SetWatchedMenuItem(Episode e) {
		super(MESSAGES.getString("MarkasSeenMI"));
		this.ep = e;
		
		this.addActionListener(new ActionListener() {

            @Override
			public void actionPerformed(ActionEvent e) {
            		for(Episode epi : EpisodesSet.previousEpisodes(ep)) {
            		epi.setSeen(true);
            		}
            		(new Thread(new ExecQuery(ep,Query.SEEN))).start();
            }
    });
		
	}


}
